package processor.html;

/**
 * The HtmlAttribute Class.
 *
 * Created: 3-Jan-2012
 * Last Modified: 3-Jan-2012
 * @author Shimu
 */
public class HtmlAttribute {
    
    public final static HtmlAttribute DEFAULT_ATTRIBUTE = 
            new HtmlAttribute("", "");
    
    protected final String CLASS_NAME;
    protected final String ID;
        
    public HtmlAttribute(String className, String id){
        if (className == null){
            this.CLASS_NAME = "";
        } else {
           this.CLASS_NAME = className; 
        }    
        
        if (id == null){
            this.ID = "";
        } else {
            this.ID = id;
        }        
    }
    
    @Override
    public String toString(){
        StringBuilder builder = new StringBuilder(30);
        if (!this.CLASS_NAME.isEmpty()) {
            builder.append("class = \"");
            builder.append(this.CLASS_NAME);
            builder.append("\"");
        }
        if (!this.ID.isEmpty()){
            builder.append("id = \"");
            builder.append(this.ID);
            builder.append("\"");
        }
        return builder.toString();
    }
}
